package io.renren.modules.wmcurdata.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.wmcurdata.entity.WeldingmachineCurdataEntity;
import io.renren.modules.wmcurdata.service.WeldingmachineCurdataService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-08-28 10:26:32
 */
@RestController
@RequestMapping("wmcurdata/weldingmachinecurdata")
public class WeldingmachineCurdataController {
    @Autowired
    private WeldingmachineCurdataService weldingmachineCurdataService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("wmcurdata:weldingmachinecurdata:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = weldingmachineCurdataService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{wmNo}")
    @RequiresPermissions("wmcurdata:weldingmachinecurdata:info")
    public R info(@PathVariable("wmNo") Integer wmNo){
		WeldingmachineCurdataEntity weldingmachineCurdata = weldingmachineCurdataService.getById(wmNo);

        return R.ok().put("weldingmachineCurdata", weldingmachineCurdata);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("wmcurdata:weldingmachinecurdata:save")
    public R save(@RequestBody WeldingmachineCurdataEntity weldingmachineCurdata){
		weldingmachineCurdataService.save(weldingmachineCurdata);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("wmcurdata:weldingmachinecurdata:update")
    public R update(@RequestBody WeldingmachineCurdataEntity weldingmachineCurdata){
		weldingmachineCurdataService.updateById(weldingmachineCurdata);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("wmcurdata:weldingmachinecurdata:delete")
    public R delete(@RequestBody Integer[] wmNos){
		weldingmachineCurdataService.removeByIds(Arrays.asList(wmNos));

        return R.ok();
    }

}
